package com.silverbox.shopper.service.goods.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.silverbox.shopper.entity.*;
import com.silverbox.shopper.entity.extend.*;
import com.silverbox.shopper.entity.extend.GoodsGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.silverbox.shopper.mapper.GoodsMapper;
import com.silverbox.shopper.mapper.GoodsPropsExtendMapper;
import com.silverbox.shopper.mapper.HotGoodsWeekMapper;
import com.silverbox.shopper.mapper.QrcodeMapper;
import com.silverbox.shopper.mapper.RecommendGoodsMapper;
import com.silverbox.shopper.mapper.RelGoodsTimeMapper;
import com.silverbox.shopper.mapper.ShopSystemGoodsMapper;
import com.silverbox.shopper.mapper.SizeMapper;
import com.silverbox.shopper.service.goods.ShopperGoodsService;
import com.silverbox.sweeporder.controller.index.vo.GoodsVO;

@Service
public class ShopperGoodsServiceImpl implements ShopperGoodsService {
    @Autowired
    private HotGoodsWeekMapper hotGoodsWeekMapper;

    @Autowired
    private GoodsMapper goodsMapper;

    @Autowired
    private GoodsPropsExtendMapper goodsPropsExtendMapper;

    @Autowired
    private RelGoodsTimeMapper relGoodsTimeMapper;

    @Autowired
    private SizeMapper sizeMapper;

    @Autowired
    private QrcodeMapper qrcodeMapper;

    @Autowired
    private ShopSystemGoodsMapper shopSystemGoodsMapper;

    @Autowired
    private RecommendGoodsMapper recommendGoodsMapper;

    @Override
    public int isEffectGoodsGroup(Integer shopperId, Integer storeId) {
        return goodsMapper.isEffectGoodsGroup(storeId,shopperId);
    }

    @Override
    public List<GoodsGroup> getEffsctGroupByStoreId(Integer storeId, Integer shopperId) {
        return goodsMapper.getEffsctGroupByStoreId(storeId, shopperId);
    }

    @Override
    public List<GoodsGroup> getDefaultGroupByStoreId(Integer storeId, Integer shopperId) {
        return goodsMapper.getDefaultGroupByStoreId(storeId, shopperId);
    }

    @Override
    public List<GoodsGroup> getDefaultGroup(Integer storeId, Integer shopperId) {
        return goodsMapper.getDefaultGroup(storeId, shopperId);
    }

    @Override
    public List<CategoryGoods> getEffsctGoodsGroupByStoreId(GoodsGroupParam goodsGroupParam) {
        return goodsMapper.getEffsctGoodsGroupByStoreId(goodsGroupParam);
    }


    @Override
    public List<GoodsGroup> getEffsctGroupByShopperId(Integer storeId,Integer shopperId) {
        return goodsMapper.getEffsctGroupByShopperId(storeId,shopperId);
    }

    @Override
    public List<GoodsGroup> getDefaultEffsctGroupByShopperId(Integer storeId,Integer shopperId) {
        return goodsMapper.getDefaultEffsctGroupByShopperId(storeId,shopperId);
    }

    @Override
    public List<CategoryGoods> getEffsctGoodsGroupByShopperId(GoodsGroupParam goodsGroupParam) {
        return goodsMapper.getEffsctGoodsGroupByShopperId(goodsGroupParam);
    }

   /* @Override
    public List<CategoryGoods> getGoodsDefaultSize(GoodsExtendParam param) {
        return goodsMapper.getGoodsDefaultSize(param);
    }*/

    @Override
	public List<CategoryGoods> getCategoryGoods(GoodsExtendParam param) {
		List<CategoryGoods> categoryGoods = goodsMapper.getCategoryGoods(param);
		return categoryGoods;
	}

    @Override
    public List<CategoryGoodsDetail> getGoodsDetail(Integer storeId, Integer goodsId) {
        return goodsMapper.getGoodsDetail(storeId, goodsId);
    }

    @Override
	public List<DiscountInfo> getDiscountInfoList(String shopId, Integer goodsId, String nowDate, Integer dayTime) {
		return goodsMapper.getDiscountInfoList(shopId, goodsId, nowDate, dayTime);
	}

	@Override
	public List<GoodsPropsExtend> getGoodsBindPropsList(Integer goodsId, Integer shopperId, Integer storeId) {
		return goodsPropsExtendMapper.getGoodsBindPropsList(goodsId, shopperId, storeId);
	}

	@Override
	public List<GoodsPropsExtend> getShopBindPropsList(Integer shopperId, Integer storeId) {
		return goodsPropsExtendMapper.getShopBindPropsList(shopperId, storeId);
	}

	@Override
	public List<NormalPackage> getNormalPackageList(Integer shopperId) {
		return goodsPropsExtendMapper.getNormalPackageList(shopperId);
	}

	@Override
	public List<CombinationPackage> getCombinationPackageList(Integer shopperId, Integer storeId) {
		return goodsPropsExtendMapper.getCombinationPackageList(shopperId, storeId);
	}

	@Override
	public List<GoodsPropsExtend> getAllGoodsBindPropsList(Integer shopperId, Integer storeId) {
		List<GoodsPropsExtend> goodsPropsExtend = goodsPropsExtendMapper.getAllGoodsBindPropsList(shopperId, storeId);
		return goodsPropsExtend;
	}

	@Override
	public List<DaypartingGoods> getDaypartingGoods(Integer storeId, Integer weekNum, String nowDate) {
		return relGoodsTimeMapper.getDaypartingGoods(storeId, weekNum, nowDate);
	}

	@Override
	public List<Map<String,Object>> isSelloutByGoodsId(Integer storeId, List<Integer> goodsId, String startDate, String endDate,
			String nowDate) {
		return goodsMapper.isSelloutByGoodsId(storeId, goodsId, startDate, endDate, nowDate);
	}

	@Override
	public List<Size> getSizeInfoByGoodsId(List<Integer> goodsIds) {
		return sizeMapper.getSizeInfoByGoodsId(goodsIds);
	}

	@Override
	public List<CombinationPackage> getCombinationPackage(Integer shopperId, Integer storeId, String startDate,
			String endDate, String nowDate, Integer packageId) {
		return goodsPropsExtendMapper.getCombinationPackage(shopperId, storeId, startDate, endDate, nowDate, packageId);
	}

	@Override
	public List<NormalPackage> getNormalPackage(Integer shopperId, Integer storeId, Integer packageId) {
		return goodsPropsExtendMapper.getNormalPackage(shopperId, storeId, packageId);
	}

	@Override
	public void updateHotByCallAble(Integer storeId, String nowDate, String weekDate) {
		hotGoodsWeekMapper.updateHotByCallAble(storeId, nowDate, weekDate);
	}

	@Override
	public List<HotGoodsWeek> getHotWeekGoods(Integer storeId, Integer isHand, Integer maxNum) {
		return hotGoodsWeekMapper.getHotWeekGoods(storeId, isHand, maxNum);
	}

	@Override
	public List<CategoryGoods> getSystemGoodsInfo(List<String> systemGoods) {
		return goodsMapper.getSystemGoodsInfo(systemGoods);
	}

	@Override
	public List<HotGoodsWeek> getOldHotGoodsWeek(Integer storeId, String todayStart, String todayEnd) {
		return hotGoodsWeekMapper.getOldHotGoodsWeek(storeId, todayStart, todayEnd);
	}

	@Override
	public List<CategoryGoods> getNeedGoodsInfoList(GoodsExtendParam goodsExtendParam) {
		return goodsMapper.getNeedGoodsInfoList(goodsExtendParam);
	}

	@Override
	public Qrcode getQrcodeGoodsInfo(Integer storeId,Integer goodsId,Long sizeId) {

		return qrcodeMapper.getQrcodeGoodsInfo(storeId,goodsId,sizeId);
	}

	@Override
	public List<CategoryGoods> getGoodsInfoByGoodsId(GoodsExtendParam goodsExtendParam) {
		List<CategoryGoods> categoryGoods = goodsMapper.getGoodsInfoByGoodsId(goodsExtendParam);
		return categoryGoods;
	}

	@Override
	public List<RequiredCategory> getRequiredCategory(Integer storeId, Integer shopperId, String tableUid) {
		return goodsMapper.getRequiredCategory(storeId,shopperId,tableUid);
	}

	@Override
	public List<SystemGoodsExtend> getShopSystemGoods(Integer storeId, Integer shopperId, String tableUid,int weekNum) {
		return shopSystemGoodsMapper.getShopSystemGoods(storeId,shopperId,tableUid,weekNum);
	}

	@Override
	public List<GoodsPropsExtend> getGoodsCookingsList(Integer goodsId, Integer shopperId) {
		return goodsPropsExtendMapper.getGoodsCookingsList(goodsId,shopperId);
	}

	@Override
	public List<GoodsPropsExtend> getAllGoodsCookingsList(Integer shopperId) {
		return goodsPropsExtendMapper.getAllGoodsCookingsList(shopperId);
	}

	@Override
	public List<RecommendGoods> getRecommendGoods(Integer shopperId, Integer storeId) {
		return recommendGoodsMapper.getRecommendGoods(shopperId,storeId);
	}

	@Override
	public void deleteHotGoodsSqlForSystemSet(Integer storeId,
			Integer shopperPid) {
		hotGoodsWeekMapper.deleteHotGoodsSqlForSystemSet(storeId, shopperPid);
	}

	@Override
	public void insertHotGoodsSqlForSystemSet(Date createTime, List<HotGoodsWeek> hotGoodsList) {
		hotGoodsWeekMapper.insertHotGoodsSqlForSystemSet(createTime, hotGoodsList);
	}

	@Override
	public List<HotGoodsWeek> selectHotGoodsSqlForSystemSet(Integer storeId,
			Integer shopperPid, String nowDate, String weekDate) {
		return hotGoodsWeekMapper.selectHotGoodsSqlForSystemSet(storeId, shopperPid, nowDate, weekDate);
	}

	@Override
	public List<HotGoodsWeek> selectHotGoodsSqlForCustomSet(Integer storeId,
			Integer shopperPid, String nowDate, String weekDate, Integer goodsId, Long sizeId) {
		return hotGoodsWeekMapper.selectHotGoodsSqlForCustomSet(storeId, shopperPid, nowDate, weekDate, goodsId, sizeId);
	}

	@Override
	public void updateHotGoodsSqlForCustomSet(Double totalVolume, Integer storeId, Integer shopperPid, Integer goodsId, Long sizeId) {
		hotGoodsWeekMapper.updateHotGoodsSqlForCustomSet(totalVolume, storeId, shopperPid, goodsId, sizeId);
	}

	@Override
	public List<HotGoodsWeek> getCustomHotGoodsWeek(Integer storeId,
			Integer shopperPid) {
		return hotGoodsWeekMapper.getCustomHotGoodsWeek(storeId, shopperPid);
	}

	@Override
	public List<GroupGoodsExtend> getGroupGoodsList(Integer cookId) {
		return goodsMapper.getGroupGoodsList(cookId);
	}
}
